home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / sd50.arc / SD50.DOC < prev   
Text File  |  1986-05-16  |  21KB  |  488 lines

  1. ------------------------------------------------------------------------
  2.  
  3.           SD: MS-DOS Sorted Directory Utility Program
  4.  
  5.           Version 5.0 (C) 12-Feb-86 by John F. Stetson
  6.  
  7. ------------------------------------------------------------------------
  8.  
  9. Introduction
  10.  
  11. ------------------------------------------------------------------------
  12.  
  13. SD.COM is a sorted directory utility program which  operates  under  the
  14. Microsoft  Disk  Operating  System  Version  2 and above.  There are two
  15. different versions of the program tailored for either the  Zenith  Z-100
  16. series computers or IBM-PC compatible computers.
  17.  
  18. SD provides more information than the MS-DOS resident DIR command  about
  19. the  files on a disk, and allows the user to select, sort and format the
  20. information in a variety of ways.  The program    uses  the  BIOS  (rather
  21. than  DOS) for console output, as a default, which results in noticeably
  22. faster displays.  Command output can still be redirected  to  an  output
  23. file  by using a special switch.  Every effort has been made to keep the
  24. size of the program to a minimum, for use on floppy disk based    systems.
  25. However,  many    of  the capabilities of both  MS-DOS  and  this  program
  26. are only fully    realized  when    using  large  hard  (fixed)  disks  with
  27. hierarchical directory structures to organize files.
  28.  
  29. ------------------------------------------------------------------------
  30.  
  31. Command Line Syntax
  32.  
  33. ------------------------------------------------------------------------
  34.  
  35. The complete form of the DOS command line to run the program is:
  36.  
  37. D>sd [drive:][path][filespec] [/switches] [>[>]device/file]
  38.  
  39. In most cases, only one or two parameters are specified, so the  command
  40. syntax    isn't  as  formidable  as  it  may appear at first.  Each of the
  41. command line parameters is optional (as the [] characters indicate)  and
  42. may  be  used  together in any combination or order.  Spaces may also be
  43. freely used at any point to improve readability.   The    various  command
  44. line parameters are described below:
  45.  
  46. [drive:]
  47.  
  48. This parameter specifies the name of the disk  drive  to  be  processed.
  49. Typical  drive    letters  are A: or B: for floppy disks and C: for a hard
  50. disk on the IBM-PC/XT or E: on the Zenith Z-100.    RAM  (memory)  disks
  51. installed  as  device  drivers may also be specified, and typically have
  52. the highest drive letter currently in use  by  the  system  assigned  to
  53. them.     If  no drive letter is specified, the currently logged-in drive
  54. (shown in the DOS prompt) is used.
  55.  
  56. [path]
  57.  
  58. This parameter specifies the path  through  the  hierarchical  directory
  59. structure  to  the  desired  directory    which  contains  the files to be
  60. processed.  The general form of the path parameter is shown below:
  61.  
  62. [path] = [\][directory][\directory]...[\directory][\]
  63.  
  64. The path name may simply be the name of the root directory (\),  or  the
  65. same of a subdirectory in the root directory.  The standard DOS . and ..
  66. directory names  may  be  used    to  refer  to  the  current  and  parent
  67. directories,  respectively.    If  a  path is not specified, the current
  68. directory on the specified disk drive is used.
  69.  
  70. [filespec]
  71.  
  72. This parameter specifies  which  file  names  are  to  be  selected  for
  73. processing from the previously specified directory (if any).  A complete
  74. (unambiguous) file name may be specified, or  an  ambiguous  file  name,
  75. containing  'wildcard'    characters  (?    or *) may be specified to select
  76. several files. Either the file name (first 8  characters)  or  the  file
  77. extension  (last  3  characters)  or both may be completely omitted.  In
  78. these cases, wildcard characters are automatically  used  to  match  all
  79. possible  file names in the selected directory.  You may specify leading
  80. characters of the file names you wish to match,  omitting  the    trailing
  81. characters of the name, the period delimiter, and the file extension. In
  82. this respect, SD processes file specifications differently than DIR.
  83.  
  84. [/switches]
  85.  
  86. This parameter specifies one or more 'switch'  or  option  values  which
  87. modify    the operation of the command.  All switches are optional and may
  88. be specified before the drive, path, and filespec, after them,    or  both
  89. before    and  after.  An  almost infinite variety of different processing
  90. modes may be selected by combining  the  various  switches  together  in
  91. different combinations.  Each switch has a default value, which has been
  92. carefully selected to represent the most  frequently  used  option,  for
  93. most  users.    Specifying  a switch overrides or 'toggles' the value of
  94. that command option.  A special 'patch' area has  been provided  at  the
  95. beginning  of the SD.COM file so that sophisticated users can tailor the
  96. default switch settings to their needs.  If a default  switch  value  is
  97. modified,  specification  of  that option will toggle the option back to
  98. its original state,  if  appropriate.     Detailed  descriptions  of  all
  99. switches are given below.
  100.  
  101. [>[>]device/file]
  102.  
  103. This parameter is actually a standard feature of DOS called  redirection
  104. of  output  to    the  'standard output' (stdout) device.  This allows the
  105. console output generated by the program  to  be  transmitted  to  either
  106. another device (usually the printer device (PRN)), or to a disk file. By
  107. redirecting the output of the command to a file, you can later    use  the
  108. file  as input to a word processor, master disk catalog system, etc.  If
  109. this parameter is specified, the /r switch must  also  be  specified  so
  110. that  the  program  will  know    to  use  the standard DOS console output
  111. services instead of those in the BIOS, which cannot be redirected.
  112.  
  113. ------------------------------------------------------------------------
  114.  
  115. Command Line Switches
  116.  
  117. ------------------------------------------------------------------------
  118.  
  119. If a switch value other than those described below is specified, such as
  120. /h  or    /x,  the  console screen is cleared and a summary of the command
  121. line syntax information is displayed.
  122.  
  123.  
  124. File Selection
  125.  
  126. These switches are used to further restrict  which  files  are    selected
  127. (in addition to any filespec) based on the attributes of the files.
  128.  
  129. If a /s switch is not specified, the default is to  select  all  of  the
  130. subdirectories    and  files in the specified directory, except those with
  131. either the system or hidden attribute.
  132.  
  133. /s  - Select all directories and files including system and hidden
  134. /sd - Select only directories (no files)
  135. /sa - Select only files with the archive attribute
  136. /sr - Select only files with the read-only attribute
  137. /sh - Select only files with the hidden attribute
  138. /ss - Select only files with the system attribute
  139.  
  140. File selection switches may either be specified separately or together:
  141.  
  142. D>sd e:\dir/sa/sr    - or -    D>sd e:\dir/sar
  143.  
  144. When multiple /s switches are specified, the effect is 'additive';  i.e.
  145. for  the  example  above  all files with either the archive or read-only
  146. attribute will be selected from the specified directory.
  147.  
  148.  
  149. Sort Fields
  150.  
  151. These switches specify which fields are to be used as sort  'keys'  when
  152. formatting  the  output  information.     These switches are all mutually
  153. exclusive; i.e. only one sort switch should be specified.   If    no  sort
  154. switches are specified, the /f switch is the default.
  155.  
  156. /f - Ascending sort by (1) file name and (2) extension
  157. /e - Ascending sort by (1) file extension and (2) name
  158.  
  159. /b - Ascending sort by file sizes in bytes (smallest first)
  160.  
  161. /d - Descending sort by (1) file date and (2) time (newest first)
  162. /a - Ascending sort by (1) file date and (2) time (oldest first)
  163.  
  164. /n - No sort - display entries in directory order
  165.  
  166.  
  167. Output Control
  168.  
  169. These switches are used to specify the    appearance  and  format  of  the
  170. generated  output  and other miscellaneous functions.  The switches fall
  171. into two categories and are described separately.
  172.  
  173. The first group of output switches selects the number of output columns.
  174. A  larger  number  of  columns    allows more files to be displayed on the
  175. console screen at one time, at the cost of losing some of  the    detailed
  176. file information.  A smaller number of columns allows more detailed file
  177. information to be displayed, at the cost of only being able to display a
  178. limited  number of files.  All of these switches are mutually exclusive;
  179. only one should be specified.  The default switch is /4.
  180.  
  181. /1 - 1 output column  - path, file name, size, date, time, attributes
  182. /2 - 2 output columns - file name, size, date and time
  183. /4 - 4 output columns - file name and size
  184. /6 - 6 output columns - file names only
  185.  
  186. If the /1 switch is specified, the output information  begins  with  the
  187. specified  path  name.     This can be useful when used as input to a disk
  188. catalog program.  The output ends with file attribute information.  Each
  189. file attribute (if any) is denoted by a letter:
  190.  
  191. A - Archive    R - Read-Only    H - Hidden    S - System
  192.  
  193. The archive attribute is turned on when a file    is  written  to  and  is
  194. turned off by the BACKUP program when the file is backed up.
  195.  
  196. The time a file was last written to is only accurate to a resolution  of
  197. 2  seconds;  all  values  will    have  an  even number of seconds.  Files
  198. created with early versions of DOS may not have either a  date    or  time
  199. stamp.    In this case, these fields will appear as periods.
  200.  
  201. The next group of switches are all 'toggles'; i.e. their  default  state
  202. is  'off'  and    they are toggled 'on' when specified.  These may be used
  203. together in all possible combinations.
  204.  
  205. /c - Clear the console screen before displaying output
  206. /q - Quick output (no pause when the console screen fills)
  207. /r - Generate output which is suitable for redirection
  208.  
  209. /v - Display disk volume label and creation date & time
  210. /k - Display file sizes and disk space in rounded kbytes
  211. /t - Display only the trailing totals summary lines
  212.  
  213. Console output may be paused by typing any character  and  is  restarted
  214. when  another  character  is  typed.   If /q is not specified, output is
  215. paused every time the screen fills.  Typing Control-Break  or  Control-C
  216. will terminate the program prematurely.
  217.  
  218. If it is desired to redirect console output to a file or to the printer,
  219. the  /r  switch  must  be  specified  to tell the program to use the DOS
  220. console output    services.    This  applies  to    both  the  command  line
  221. redirection  symbol (>) and to the Control-P printer echo function.  The
  222. program normally displays a graphics vertical  bar  symbol  to    separate
  223. adjacent columns of output information.  This is changed to the standard
  224. ASCII (|) character if redirection is requested.  Specification  of  the
  225. /r switch causes the /q switch to be turned on automatically.
  226.  
  227. The /v switch causes the disk volume label (if any), and volume creation
  228. date and time to be displayed at the beginning of the output.  If the /t
  229. switch is also specified, several disk parameter values are displayed on
  230. a separate output line.  The disk parameters displayed are:
  231.  
  232. FAT Media Byte, Bytes/Sector, Bytes/Cluster, Total Clusters on Disk
  233.  
  234. The /k switch requests that file size  and  disk  space  information  be
  235. displayed  in  units  of kilobytes (1024 bytes), rather than the default
  236. units of bytes.  In addition, these values are    rounded  upward,  taking
  237. into  account the allocation unit (cluster) size for the specified disk.
  238. Typical values of cluster sizes for standard disk types are shown below:
  239.  
  240. Disk Type              Capacity       Cluster Size
  241. ---------              --------       ------------
  242. SS 48 TPI 8 Sectors/Track    156K        512
  243. SS 48 TPI 9 Sectors/Track    177K        512
  244. DS 48 TPI 8 Sectors/Track    313K           1024
  245. DS 48 TPI 9 Sectors/Track    354K           1024
  246. DS 96 TPI 8 Sectors/Track    626K           2048
  247. DS 96 TPI 9 Sectors/Track    708K           2048
  248. Winchester (Hard) Disk        10M           4096
  249. Winchester (Hard) Disk        20M           8192
  250.  
  251. Most DOS disks use 512 bytes per  sector,  and    with  the  12  bit  File
  252. Allocation  Table entries prior to DOS V3 (4096 clusters), this requires
  253. that progressively greater cluster  sizes  be  used  to  support  larger
  254. storage  devices.    This  can    result in a substantial amount of wasted
  255. space for large capacity hard disks with many  relatively  small  files.
  256. DOS  V3 added support for 16 bit FAT entries which allows 65536 clusters
  257. to be used, thus allowing a much smaller cluster size to be used with  a
  258. corresponding  better  utilization  of    disk  space.    For disks with a
  259. cluster size less than 1024 bytes, the /k switch causes the  file  sizes
  260. and  disk  space  values to be displayed in bytes, but rounded up to the
  261. cluster size, since using units of kbytes would be somewhat inaccurate.
  262.  
  263. The /t switch requests that only the trailing totals  summary  lines  be
  264. displayed.    This  option  is useful when you wish to compare the total
  265. number or sizes of files on two different disks or directories.    If  a
  266. difference is detected, other switches (such as /b or /d) can be used to
  267. determine which files are missing.  A typical example is given below:
  268.  
  269. D>sd e:\asm/s/t
  270.  
  271. Path: E:\ASM  Dirs: 1  Files: 10  Arch: 2  Read: 0  Hid: 0  Sys: 0
  272. Bytes Used: 98765  Free: 234567  Total: 23511040  Thu 20-Feb-86 12:36:19
  273.  
  274. In this example, the target directory is subdirectory ASM  in  the  root
  275. directory  on  drive E:, it contains 1 subdirectory and 10 files without
  276. the system or hidden attribute.  Of these  files,  2  have  the  archive
  277. attribute,  indicating    that  they  have been either created or modified
  278. since BACKUP was last run, and none of    the  selected  files  is  marked
  279. read-only.    The  number  of  bytes  used  by these files (ignoring the
  280. cluster size, as discussed above) is shown, along  with  the  disk  free
  281. space  and  the  total disk size in bytes.  The current day of the week,
  282. date and time are also displayed.  The    numbers  of  hidden  and  system
  283. files are only displayed on the first totals line if the /s, /sh, or /ss
  284. file selection switchs are specified.
  285.  
  286.  
  287. Modifying the Default Switch Values
  288.  
  289. The default switch values may be altered by using  DEBUG.COM  to  modify
  290. the following bytes at the beginning of the SD.COM file:
  291.  
  292. Offset        Switch    Default      Possible Value(s)
  293. ------        ------    -------      -----------------
  294.  0102         Sort      'F'         'A', 'B', 'D', 'E', 'F', 'N'
  295.  0103         Cols      '4'         '1', '2', '4', '6'
  296.  0104          /c       0          0, 1=Clear console screen
  297.  0105          /k       0          0, 1=Display space in kbytes
  298.  0106          /q       0          0, 1=Quick output (no pauses)
  299.  0107          /r       0          0, 1=Allow output redirection
  300.  0108          /t       0          0, 1=Totals output lines only
  301.  0109          /v       0          0, 1=Volume label information
  302.  
  303. Example:
  304.  
  305. D>DEBUG SD.COM      (load SD.COM into memory using DEBUG.COM)
  306. -E103 '2'      (Change the default number of columns to 2)
  307. -E109 01      (Display the volume label info as a default)
  308. -W          (Write the modified file back to disk)
  309. -Q          (Exit to DOS from DEBUG)
  310. D>sd          (Execute the modified version of SD.COM)
  311.  
  312. ------------------------------------------------------------------------
  313.  
  314. Examples of Use
  315.  
  316. ------------------------------------------------------------------------
  317.  
  318. A>sd
  319.  
  320. Display the current directory of drive A.
  321.  
  322. B>sd/d/6
  323.  
  324. Display the current directory of drive B, sorted by descending date  and
  325. time, using the six column format (file names only).
  326.  
  327. D>sd c:\/ss/2
  328.  
  329. Display only the system files in the root directory of    drive  C,  using
  330. the two column output format.
  331.  
  332. C>sd b:/t
  333.  
  334. Display the totals information for the current directory of drive B.
  335.  
  336. A>sd *.asm/b
  337.  
  338. Display all files having an extension of "asm" in the current  directory
  339. of drive A and sort the output by file size.
  340.  
  341. D>sd/v/n/1/r
  342.  
  343. Display volume label information and all files in the current  directory
  344. of  drive D, do not sort the file entries, use one output column, do not
  345. pause when the console screen fills, and allow output redirection.  This
  346. combination of switches causes SD to behave similarly to DIR.
  347.  
  348. B>sd \/s/n/2
  349.  
  350. Select all files in the root directory of drive B, including those  with
  351. the  hidden  and/or  system attribute, do not sort the file entries, and
  352. display the output using the two column format.
  353.  
  354. B>sd/r temp.* >c:temp.dir
  355.  
  356. Select all files having a name of "temp" in  the  current  directory  of
  357. drive B, and redirect the console output to file "c:temp.dir".
  358.  
  359. B>sd/r/1 c:\*.com >>c:temp.dir
  360.  
  361. Select all files with an extension of "com" in    the  root  directory  of
  362. drive  C,  format  using  one  output  column,    and redirect the console
  363. output, appending to the file "c:temp.dir".
  364.  
  365. D>sd a:/v/t
  366.  
  367. Display volume label information, disk parameter information, and totals
  368. information for the current directory of drive A.
  369.  
  370. A>sd t/c/k/q
  371.  
  372. Select all files in the current directory of drive A whose  names  begin
  373. with  "t",  clear the screen before displaying output, display file size
  374. and disk space values in kilobytes and do not pause the console output.
  375.  
  376. C>sd \/e
  377.  
  378. Display all files in the root  directory  of  drive  C    sorted    by  file
  379. extension and by file name.
  380.  
  381. B>sd temp
  382.  
  383. If temp is an existing subdirectory in the current directory of drive B,
  384. then  select  all of the files in that directory.  Otherwise, select all
  385. files in the current directory of drive B whose names begin with "temp".
  386.  
  387. A>sd ../sar
  388.  
  389. Display all files in the parent directory of the  current  directory  of
  390. drive A with either the archive or read-only attribute.
  391.  
  392. B>sd ..\*.a?m/a/4
  393.  
  394. Display all files in the parent directory of the  current  directory  of
  395. drive  B  whose  extensions begin with "a" and end with "m" and sort the
  396. output by ascending date and time using the four column output format.
  397.  
  398. C>sd/r/v/1 b:\dir1\dir2\dir3\*.doc/d >prn
  399.  
  400. Select    all  files  having  an    extension  of  "doc"  in  the  directory
  401. "\dir1\dir2\dir3"  of  drive  B.  Sort the output by date and time.  Use
  402. the one column output  format  and  include  volume  label  information.
  403. Redirect the console output to the printer.
  404.  
  405. A>sd b:/r (Type Control-P/Return)
  406. (console output is duplicated on the printer)
  407. A>      (Type Control-N/Return)
  408.  
  409. Display the current directory of  drive  B  and  duplicate  the  console
  410. output on the printer.
  411.  
  412. ------------------------------------------------------------------------
  413.  
  414. Enhancements in this Version
  415.  
  416. ------------------------------------------------------------------------
  417.  
  418. This version  of  SD.COM  (5.0)  contains  the    following  enhancements,
  419. changes, and fixes from the previous version (4.4):
  420.  
  421. Added /1/2/4/6 output column switches and removed /l switch.
  422.  
  423. Changed default output format from 2 to 4 column display.
  424.  
  425. Added display of seconds to time information for files.
  426.  
  427. Added directory path display to output information.
  428.  
  429. Added number of directories and file types to output.
  430.  
  431. Added total disk space to output information.
  432.  
  433. Added /f sort by filename switch (default sort type).
  434.  
  435. Changed /e switch to sort by both file extension and name.
  436.  
  437. Added trailing CR/LF if /r switch is specified.
  438.  
  439. Added patch area to allow switch defaults to be changed.
  440.  
  441. Changed parsing to allow switches before and after filespec.
  442.  
  443. Fixed several miscellaneous path/filespec parsing bugs.
  444.  
  445. Changed path detection to work the same way DIR does.
  446.  
  447. Added graphics vertical bar character for IBM-PC.
  448.  
  449. Suppressed display of . and .. subdirectories.
  450.  
  451. Changed display to 25 output lines for IBM-PC.
  452.  
  453. Suppressed trailing delimiter if only one output line.
  454.  
  455. Added bad filespec message instead of syntax message.
  456.  
  457. Added /k switch to display disk space in rounded kbytes.
  458.  
  459. Expanded /s switch with d,a,r,h,s file selection values.
  460.  
  461. Added display of disk parameters if both /v and /t specified.
  462.  
  463. Removed support for operation under MS-DOS V1.
  464.  
  465. ------------------------------------------------------------------------
  466.  
  467. Additional Information
  468.  
  469. ------------------------------------------------------------------------
  470.  
  471. This program is in the public domain and may be freely copied as long as
  472. the  only  charge  is  for  media and reproduction costs, etc.    Under no
  473. conditions should the program either be sold for a profit or distributed
  474. in  modified  form without the permission of the author.  If you wish to
  475. contact me  with  bug  reports,  suggestions  for  improvements,  and/or
  476. especially  large  financial  donations,  I  can  be  reached  using the
  477. information provided below:
  478.  
  479. John F. Stetson
  480. 3144 Hewitt Ave., #143
  481. Silver Spring, Md. 20906
  482.  
  483. (Home) (301) 460-3881 (after 7 PM)
  484. (Work) (301) 340-4544
  485.  
  486. Compuserve [70320,353]
  487. ------------------------------------------------------------------------
  488.